using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using IOLib;

namespace SHS_SE
{
    public partial class PrintPreview : System.Windows.Forms.Form
    {

        public PrintPreview()
        {
            InitializeComponent();
            Document = new System.Drawing.Printing.PrintDocument();
            comboBox1.SelectedIndex = 0;
            printButton.Text = GlobalParams.LanguageForm[201];
            label1.Text = GlobalParams.LanguageForm[202];
            label2.Text = GlobalParams.LanguageForm[203];
            this.Text = GlobalParams.LanguageForm[199];
        }

        private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
                case 0:
                    printPreviewControl1.AutoZoom = true;
                    return;

                case 1:
                    printPreviewControl1.Zoom = 4.0;
                    return;

                case 2:
                    printPreviewControl1.Zoom = 2.0;
                    return;

                case 3:
                    printPreviewControl1.Zoom = 1.5;
                    return;

                case 4:
                    printPreviewControl1.Zoom = 1.0;
                    return;

                case 5:
                    printPreviewControl1.Zoom = 0.75;
                    return;

                case 6:
                    printPreviewControl1.Zoom = 0.5;
                    return;

                case 7:
                    printPreviewControl1.Zoom = 0.25;
                    break;
            }
        }

        private void pageCount_ValueChanged(object sender, System.EventArgs e)
        {
            printPreviewControl1.StartPage = (int)pageCount.Value - 1;
        }

        private void printButton_Click(object sender, System.EventArgs e)
        {
            try
            {
                Document.Print();
            }
            catch
            {
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void printPreviewControl1_Click(object sender, System.EventArgs e)
        {
            printPreviewControl1.Focus();
        }

        protected override void OnLoad(System.EventArgs e)
        {
            printPreviewControl1.Document = Document;
            base.OnLoad(e);
        }

    } // class PrintPreview

}

